using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using System.IO.Ports;
using System.Text;
using System.Collections;

#if MINI
using SecretLabs.NETMF.Hardware.NetduinoMini;
#else
using SecretLabs.NETMF.Hardware.Netduino;
#endif

namespace codebase
{
    public class SimpleDemos
    {
        static PiezoSpeaker speaker;
        static string[] tunes;

        public static void demoMusic()
        {
#if MINI
            speaker = new PiezoSpeaker(Pins.GPIO_PIN_20);
#else
            speaker = new PiezoSpeaker(Pins.GPIO_PIN_D5);
#endif
            tunes = new string[] 
            {
                "C * F / F * F A G / F * G A F / F A + C D" //, // Auld Lang Syne
               // "D / D * * E D G * F# / / D / D * * E D A * G / / D / D * * + D - B G F# * E / / + C / C * * - B G A * G", // Happy birthday
               // "C C G G A A * G / F F E E D D * C / G G F F E E * D / G G F F E E * D / C C G G A A * G / F F E E D D * C" , // twinkle, twinkle
               // "A B + C D E F# G# A G F E D C - B A" // melodic minor scale
            };

            int note = -1;
            while (note < tunes.Length - 1)
            {
                note++;
                speaker.Play(tunes[note], 4, 222);

            };

            speaker = null;
        }
    }
}
